﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BPM.Entity;
using System.Data.Entity.ModelConfiguration;

namespace BPM.Service.Mappings
{
	internal class ProductAssembleItemConfiguration : EntityConfiguration<ProductAssembleItem>
	{
		public ProductAssembleItemConfiguration()
		{
			this.HasRequired(m => m.ProductAssemble)
				.WithMany(p => p.ItemList)
				.HasConstraint((m, p) => m.ProductAssembleId == p.Id)
				.WillCascadeOnDelete();

			this.HasRequired(m => m.MaterialDefinition)
				.WithMany()
				.HasConstraint((m, u) => m.MaterialDefinitionId == u.Id)
				.WillCascadeOnDelete(false);
		}
	}
}
